package com.core.baseDao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.LockMode;
import org.springframework.orm.hibernate3.HibernateTemplate;

import com.core.baseDao.extend.Pager;

/**
 * 
 * DAO基础接口，实现对POJO的基本CRUD的操�? * @author <a href="mailto:chshxuan@163.com">csx</a>
 * @param <T> POJO类型
 * @param <PK> 主键类型，如可以为Long,Integer,String�? */
public interface BaseDao <T, PK extends Serializable> {
	
		public T load(Class<T> entityClass,PK id);

		public T get(Class<T> entityClass,PK id);

		public boolean contains(T t);

		public void refresh(T t);

		public Serializable save(T t);

		public void saveOrUpdate(T t);

		public void saveOrUpdateAll(Collection<T> entities);

		public void update(T t, LockMode lockMode);

		public void update(T t);

		public void delete(T t, LockMode lockMode);

		public void delete(T t);

		public void deleteAll(Collection<T> entities);

		public List<T> find(String queryString, Object value) ;

		public List<T> find(String queryString, Object[] values) ;

		public List<T> find(String queryString) ;

		public List<T> getAll(Class<T> entityClass);
		
		public List<T> findByNamedQuery(String queryName) ;

		public List<T> findByNamedQuery(String queryName, Object value);

		public List<T> findByNamedQuery(String queryName, Object[] values);

		public Object findUnique(final String queryString, final Object[] values);
		
		public boolean exists(Class<T> entityClass,PK id);
		
		public HibernateTemplate getHibernate();
		
		public Pager getByPage(String hql,Pager pager);
		
}